package com.shelpe.services.sinbad.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shelpe.services.sinbad.dao.ProductMapper;
import com.shelpe.services.sinbad.model.Product;
import com.shelpe.services.sinbad.model.ProductExample;
import com.shelpe.services.sinbad.service.ProductService;

@Service
public class ProductServiceImpl implements ProductService{

	@Autowired
	ProductMapper productMapper;
	
	@Override
	public List<Product> getProducts(Long userId) {
		ProductExample example = new ProductExample();
		example.createCriteria().andUserIdEqualTo(userId.intValue());
		return productMapper.selectByExample(example);
	}

	@Override
	public Product getProduct(Long productId) {
		return productMapper.selectByPrimaryKey(productId);
	}

}
